package educar.controllers;

import educar.gui.IView;
import educar.controllers.CargarController;
import educar.db.JPA;
import educar.gui.CargarFacultadView;
import educar.models.Facultad;

public class CargarFacultadController implements IController {
	private JPA car;
    private CargarFacultadView com; 
    private Facultad ded;
    
    public void process(String model){
    	car = new JPA();
        String fac= com.getCap();
    	if (car.NoExistente("facultad","nombre","nombre='"+fac+"'")){
    		 ded = new Facultad (fac);
     		 ded.save();
     		 com.present("LA FACULTAD SE HA CARGADO CORRECTAMENTE EN LA BASE DE DATOS");
		     com.dispose();
    	}
            
    }

    @Override
    public void setView(IView com) {
            this.com = (CargarFacultadView) com;   
    } 

}
